package com.yssoft.controller.core;

import com.yssoft.entity.core.TAppUpdate;
import com.yssoft.service.core.AppUpdateService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @创建人: 陈翼东
 * @时间: 2018/6/7 0007 上午 11:32
 * @说明:
 */
@Controller
@RequestMapping("/appUpload")
public class AppUpdateController {
    
    @Resource
    private AppUpdateService appUpdateService;
    
    /**
     * 跳转到编辑app更新信息页面
     * @return
     */
    @RequestMapping("edit")
    public String edit(Model model){
        TAppUpdate appUpdate=appUpdateService.selectOne();
        model.addAttribute("appUpdate",appUpdate);
        return "/core/appUpload/appUploadEdit";
    }
    
    /**
     *
     * @return
     */
    @RequestMapping("/saveAppUpload")
    public String saveAppUpload(TAppUpdate appUpdate,@RequestParam("file") MultipartFile file){
        appUpdateService.saveAppUpload(appUpdate,file);
        return "redirect:edit";
    }
    
    
}
